package com.ayu.scalalearn.chapter07

/**
  * @Author 徐林玉
  * @Description Test06ImutableSet
  * @Date 2022/8/3 15:29
  * @Version 1.0
  */
object Test06ImmutableSet {
  def main(args: Array[String]): Unit = {

    //1、创建set
    val set1: Set[Int] = Set(1, 2, 3, 4, 5)

    println(set1)

    println("=================")

    //2、添加元素
    val set2 = set1 + 6
    println(set1)
    println(set2)
    println("====================")


    //3、合并set
    val set3 = Set(7, 8, 9)

    val set4 = set2 ++ set3


    println(set2)
    println(set3)
    println(set4)

    println("====================")


    //4、删除元素
    val set5 = set4 - 2
    println(set3)
    println(set5)


  }

}
